/*
 * 获取分值类边界判断的JS脚本
 * value 为值, tag为HTML的id属性
 */
function getFenColor(value) {
	var color = '#4E4848';

	if (value == null) {
		return '<font></font>';
	}

	if (value == 0) {
		color = '#4E4848'; // 默认灰色
	}

	else if (value <= 0.399) {
		color = '#FF0000';
	} else if (value <= 0.599) {
		color = '#FFCC00';
	} else if (value <= 0.7) {
		color = '#008000';
	} else if (value <= 1) {
		color = '#46F332';
	}

	else {
		color = '#4E4848'; // 超出范围也默认灰色
	}

	var itext = '<font color="' + color + '">' + value + '</font>';
	return itext;
	// document.getElementById(tag).innerHTML = itext ;
}

/*
 * 获取状态类的JS脚本 value 为值, tag为HTML的id属性
 */

function getStateColor(value, tag) {
	var color;
	var state;

	switch (value) {
	case 'S0':
		state = "草稿";
		color = "#3cd331";
		break;
	case 'S1':
		state = "已提报";
		color = "#237fcd";
		break;
	case 'S2':
		state = "审核通过";
		color = "#3cd331";
		break;
	case 'S3':
		state = "发布";
		color = "#237fcd";
		break;
	case 'S4':
		state = "申请结束";
		color = "#237fcd";
		break;
	case 'S5':
		state = "结束";
		color = "#237fcd";
		break;
	}

	var itext = '<font color="' + color + '">' + state + '</font>';

	document.getElementById(tag).innerHTML = itext;
}

/**
 * T1 公司OKR 1 T2 组织OKR 2 T3 团队OKR 3 T4 员工OKR 4
 * 
 */

function getOkrType(value, tag) {
	var color;
	var state;

	switch (value) {
	case 'T1':
		state = "公司OKR";
		break;
	case 'T2':
		state = "组织OKR";
		break;
	case 'T3':
		state = "团队OKR";
		break;
	case 'T4':
		state = "员工OKR";
		break;
	}

	var itext = '<font>' + state + '</font>';

	document.getElementById(tag).innerHTML = itext;
}
